<template>
  <div id="issue-goods">
    <van-overlay :show="overlayShow" >
      <div class="wrapper" @click.stop>
        <div class="block">
          <div class="top">
            <span class="name">恭喜开出</span>
            <van-icon name="cross" class="close-icon" @click="close" />
          </div>
          <div class="img-box">
            <div class="img-row" v-for="(item,index) in allData.data" :key="index">
              <img :src="item.thumb" alt=""  />
              <img :src="item.level.level_img_src" alt="" class="level-img">
            </div>
          </div>
          <div class="block-box">
            <span :class="isDeliverGoods && canBuy ? 'name' : !isDeliverGoods && canBuy ? 'name no-active-name' : !allData.canBuy ? 'name no-button-sty' : 'name'" @click="clickWant">我要了</span>
          </div>
          <div class="tip" @click="exchange">
            我不要，可兑换 <span class="num">{{allData.totalExchange}}</span> {{allData.exchangeTypeName}}，去兑换
            <div class="tip-icon">
              <van-icon name="arrow" class="icon" />
              <van-icon name="arrow" class="icon" />
            </div>
          </div>
        </div>
      </div>
    </van-overlay>

    <!-- 邮费 -->
    <van-popup v-model="postageShow" round  position="bottom" :style="{ height: '35%' }">
      <div class="postage-pane">
        <div class="popup-top">
          <span class="title">我要发货</span>
          <van-icon name="cross" class="close-icon" @click="clickClosePostage"/>
        </div>
        <div class="postage">
          <span class="name">邮费</span>
          <span class="num">￥{{postageNum}}</span>
        </div>
        <div class="pay-style"><span class="name" @click="clickPay">支付</span></div>
      </div>
    </van-popup>

    <!-- 兑换探币 -->
    <van-overlay :show="integralShow" @click="integralShow = false">
      <div class="integral" @click.stop>
        <div class="block">
          <div class="title">兑换</div>
          <div class="name">该盲盒可兑换{{allData.totalExchange}}{{allData.exchangeTypeName}},</div>
          <div class="is-sty">是否继续兑换?</div>
          <div class="integral-bottom">
            <span @click="cancal">取消</span>
            <span class="line"></span>
            <span class="exchange-name" @click="exchangeIntegral">兑换</span>
          </div>
        </div>
      </div>
    </van-overlay>

    <van-popup v-model="actionSheetShow" position="bottom" class="set-pc-styleLeft" :overlay="true" get-container="#appMain">
      <div class="rewardPay">
        <div class="payMode">
          <ul>
            <li @click="payPost(item)" v-for="(item, index) in btnData" :key="index">
              {{ item.name }}
            </li>
          </ul>
        </div>
        <div class="cancel" @click="rewardPayCancelBtn">取消</div>
      </div>
    </van-popup>

    <pay-keyboard :payKeyboardShow.sync="payKeyboardShow" @complete="payComplete"></pay-keyboard>
  </div>
</template>

<script>
import index_controller from "./index_controller.js";
export default index_controller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
::v-deep .van-overlay {
  z-index: 1000;
}

#issue-goods {
  .wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;

    .block {
      width: 16.8rem;
      // height: 14.5rem;
      background: #fff;
      border-radius: 0.25rem;

      .top {
        margin: 0.9rem 0.9rem 0 0.9rem;
        line-height: 1;
        position: relative;

        .name {
          font-size: 0.9rem;
          font-weight: 500;
          color: #202020;
        }

        .close-icon {
          position: absolute;
          right: 0;
        }
      }

      .img-box {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;

        .img-row {
          position: relative;
          margin: 1.08rem 0.8rem 0 0;

          img {
            width: 5.8rem;
            height: 5.8rem;
            border-radius: 0.25rem;
          }

          .level-img {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            position: absolute;
            bottom: -0.2rem;
            right: -0.5rem;
            border: 0.05rem solid #fd7383;
          }
        }
      }

      .block-box {
        color: white;
        margin-top: 1.4rem;

        .no-active-name {
          cursor: not-allowed;
          opacity: 0.5;
        }

        .name {
          padding: 0.58rem 3.83rem;
          background: #fd7383;
          font-size: 0.75rem;
          font-weight: 400;
          color: #fff;
          border-radius: 0.25rem;
        }
      }

      .tip {
        margin: 2.3rem 0 0.95rem 0.83rem;
        font-size: 0.75rem;
        font-weight: 400;
        color: #666;
        display: flex;
        align-content: center;
        line-height: 1;

        .tip-icon {
          line-height: 1.3;

          .icon {
            width: 0.3rem;
          }
        }

        .num {
          color: #fd7383;
          margin: 0 0.2rem;
        }
      }
    }
  }

  .popup-top {
    margin: 0.73rem 0.78rem 0.73rem 0;
    line-height: 1;

    .title {
      font-size: 0.8rem;
      font-weight: 400;
      color: #2b2b2b;
    }

    .close-icon {
      float: right !important;
    }
  }

  .postage {
    display: flex;
    justify-content: space-between;
    margin: 2.73rem 0.78rem;

    .num {
      color: #fd0000;
    }
  }

  .pay-style {
    display: flex;
    justify-content: center;

    .name {
      background: #fd0000;
      padding: 0.8rem 0;
      border-radius: 1.6rem;
      width: 80%;
      color: white;
    }
  }

  .integral {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;

    .block {
      width: 16.8rem;
      // height: 14.5rem;
      background: #fff;
      border-radius: 0.25rem;

      .title {
        margin: 1rem 0;
      }

      .is-sty {
        margin: 0.5rem 0 1.8rem 0;
      }

      .integral-bottom {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 3.5rem;
        border-top: 0.15rem solid #e2e2e2;
        position: relative;

        .line {
          position: absolute;
          left: 50%;
          display: block;
          height: 100%;
          width: 0.125rem;
          background: #e2e2e2;
        }

        .exchange-name {
          color: #ef6321;
        }
      }
    }
  }
}

.rewardPay {
  background-color: #f2f2f2;

  .content {
    background-color: #fff;

    span {
      color: #1c96fe;
    }

    text-align: left;
    padding: 0.6rem;
    min-height: 3.44rem;
    font-size: 0.8rem;
    line-height: 1rem;
    width: 100%;
    white-space: normal;
    word-break: break-all;
    word-wrap: break-word;
  }

  .payMode {
    ul {
      li {
        background-color: #fff;
        height: 3.44rem;
        border-bottom: 0.06rem solid #eee;
        font-size: 1rem;
        color: #333;
        line-height: 3.44rem;
      }

      li:last-of-type {
        border-bottom: none;
        margin-bottom: 0.69rem;
      }
    }
  }

  .cancel {
    background-color: #fff;
    height: 3.44rem;
    border-bottom: 0.06rem solid #eee;
    font-size: 1rem;
    color: #333;
    line-height: 3.44rem;
  }
}

.no-button-sty {
  background: #a3a3a3 !important;
}
</style>
